var app = angular.module("login", [ "ngCookies", "constApp" ]);
app.controller("loginContraller", function($scope, $http, $cookieStore,
                                               $templateCache,$const) {
    $scope.login=function(){
        console.log($scope.account);
        console.log($scope.userPassword);
        $http({
            url : URL+'oltuservice/login' ,
            method : 'POST' ,
            dataType : "json" ,
            params : { client_id : 'aaa' ,
                response_type : 'token' ,
                state : 'oltu' ,
                account : $scope.account ,
                userPassword : $scope.userPassword ,
                redirect_uri : 'http://localhost:8080/sysc/index.html'}
        }).success(function(data ) {
            if(data["access_token"]!=undefined){
                $cookieStore.put("user",data);
                location.href="purchase.html";
            }else{
               alert("用户名和密码错误！")
            }

        });
    }

})

